#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, Niklas Hauser
#
# This file is part of the modm project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------


def init(module):
    module.name = ":driver:tmp102"
    module.description = """\
# TMP102 Thermometer

The TMP102 is a digital temperature sensor with an I2C interface
and measures temperature over a range of -40 to +125 deg Celsius with a
resolution of 1/16 (0.0625) deg C and an accuracy of up to 0.5 deg C.

The sensor has a default refresh rate of 4Hz but can be set from
0.25Hz up to 33Hz using `setUpdateRate(rate)`.
The sensor will then read itself when calling the `update()` method
frequently.

However, you may manually start a conversion with `startConversion()`, wait
for 30ms and then `readTemperature()` to achieve other (less frequent)
update rates.
"""

def prepare(module, options):
    module.depends(
        ":architecture:i2c.device",
        ":architecture:register",
        ":driver:lm75",
        ":math:utils",
        ":processing:protothread",
        ":processing:timer")
    return True

def build(env):
    env.outbasepath = "modm/src/modm/driver/temperature"
    env.copy("tmp102.hpp")
    env.copy("tmp102_impl.hpp")
